fix(database_observability.postgres): Correctly handle dsn with unix sockets#6030
Open
k3-cat wants to merge 2 commits intografana:mainfrom
Open
fix(database_observability.postgres): Correctly handle dsn with unix sockets#6030k3-cat wants to merge 2 commits intografana:mainfrom
k3-cat wants to merge 2 commits intografana:mainfrom
Conversation
it can now properly handle dsn with unix sockets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief description of Pull Request
Fixes
dsnParseRegexso thatreplaceDatabaseNameInDSNcan properly handle dsn with unix sockets, instead of treating the final part of sockets path as dbname.Pull Request Details
Current behaviour
/run/{dbname}/.s.PGSQL.5432and produce error:dial unix /run/{dbname}/.s.PGSQL.5432: connect: no such file or directoryFixed behaviour
Although simply replace the
.+in matching group 1 with.*?or[^?]*can solve this issue as well, the current approach provides better robustness for future changes and edge cases (eg. unescaped spaces present in dsn).Issue(s) fixed by this Pull Request
nil
Notes to the Reviewer
.*would match\??anyway) and robustness under edge cases$in matching group 3 is dropped intentionally, as this can generally improve the performance sightlyPR Checklist